package com.starsea.book.ui.newpage.activity

import android.os.Bundle
import androidx.activity.viewModels
import com.starsea.book.base.VMBaseActivity
import com.starsea.book.constant.PreferKey
import com.starsea.book.databinding.ActivitySetBinding
import com.starsea.book.ui.main.MainActivity
import com.starsea.book.ui.newpage.LoginActivity
import com.starsea.book.ui.newpage.utils.AppManager
import com.starsea.book.ui.newpage.viewmodel.UserViewModel
import com.starsea.book.utils.putPrefBoolean
import com.starsea.book.utils.putPrefString
import com.starsea.book.utils.startActivity
import com.starsea.book.utils.viewbindingdelegate.viewBinding

/**
 * @author Lee
 * @createTime 2024-08-25 14 GMT+8
 * @desc :
 */
class SetActivity : VMBaseActivity<ActivitySetBinding, UserViewModel>() {

    override val binding by viewBinding(ActivitySetBinding::inflate)

    override val viewModel by viewModels<UserViewModel>()
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        binding.titleBarView.setOnLeftTextClickListener {
            finish()
        }
        binding.rtvBaseInfo.setOnClickListener { startActivity<BaseInfoActivity>() }
        binding.rtvAccountSafe.setOnClickListener {
            startActivity<AccountSafeActivity>()
        }
        binding.rtvPayPwd.setOnClickListener { }
        binding.rtvSignAdvert.setOnClickListener { }
        binding.rllClearCache.setOnClickListener { }
        binding.rtvPrivateDeal.setOnClickListener { }
        binding.rtvUserDeal.setOnClickListener { }
        binding.rtvAbout.setOnClickListener { }
        binding.rtvFeedBack.setOnClickListener {
            startActivity<FeedbackActivity>()
        }
        binding.rtvDeleteAccount.setOnClickListener { }
        binding.rtvLogout.setOnClickListener {
            putPrefBoolean(PreferKey.isLogin, false)
            putPrefString(PreferKey.token, "")
            startActivity<LoginActivity>()
//            AppManager.getInstance().killActivity(MainActivity::class.java)
            finish()

        }

    }

}